
#ifndef __DECRYPT_WRAPPER_H
#define __DECRYPT_WRAPPER_H

#include "DecryptionKey.h"
#include "CheckingKey.h"
#include "../aprtools/APRBucketBrigade.h"

/** Wrapper for generating and managing decryption processes. */
class DecryptWrapper
{
   public:
      DecryptWrapper(DecryptionKey *deckey);
      DecryptWrapper(DecryptionKey *deckey, CheckingKey *chkkey);
      DecryptWrapper(DecryptionKey *deckey, int decompress);
      DecryptWrapper(DecryptionKey *deckey, CheckingKey *chkkey, int decompress);
      ~DecryptWrapper();
      std::vector<char> *decryptBuffer(const char *buffer, size_t length);
      APRBucketBrigade *decryptToBucket(APRBucketBrigade *bbrgde);
   private:
      void initDecryptWrapper(DecryptionKey *deckey, CheckingKey *chkkey, int decompress);
      /** Key to be used for decryption. */
      DecryptionKey *deckeycopy;
      /** Key to be used for signature verification. */
      CheckingKey *chkkeycopy;
      /** A flag holding whether to add a decompression envelope to the process. */
      int dodecompress;
      /** A flag to say whether any verification performed was successful. */
      int wastrusted;
      /** The APR memory pool for creating bucket brigades. */
      apr_pool_t *mp;
};

#endif
